<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
// API 模板文件，可以复制
namespace api\resource\controller;

use think\Db;
use think\Request;
use think\Validate;
use cmf\controller\RestBaseController;

class Biao38Controller extends RestBaseController
{


    public function one($data)
    {

        //查 这个表的数据
        @$new_data = $data[0]['content'];
        if (empty($new_data)) {
            return '';
        }
        @$items= $new_data->text1;

        @$items = json_decode($items);
//        dump($items);
//        exit;
       $html = '
       <div style="width: 650px;margin: 0 auto;">
            <div style="font-size: 16px;font-weight: 600;margin-bottom: 15px;">十六、附件清单</div>
            <table border="1" cellspacing="0px" cellpadding="5px" width="650">
                <thead>
                <tr>
                    <td>序号</td>
                    <td>附件名称</td>
                    <td>备注</td>
                </tr>
                </thead>
                <tbody>';
//                dump($items);
//                exit;
                $i = 1;
                foreach ($items as $k=>$v) {

                        @$title = $v->text1;

                        @$file = isset($v->file) ? $v->file : '';
                        if ($file) {
                            $url = $file->url;
                            $filename = $file->filename;
                        } else {
                            $url = '';
                            $filename = '';
                        }

                        $html .='
                        <tr>
                            <td>'.@$i.'</td>
                            <td>'.@$title.'</td>
                            
                            <td><a download="file" href='.@$url.'>'.@$filename.'</a></td>
                        </tr>';
                $i++;

                }

        $html .='
                </tbody>
            </table>
        </div>
        ';

            return $html;

    }



}
